package com.yangjian.main;

public class JJMain {
	
	static int printCount = 10;
	
	public static void main(String[] args) {
		
		
		createThreadStart("thread_00");
		createThreadStart("thread_01");
		createThreadStart("thread_02");
		createThreadStart("thread_03");
		createRunnableThreadStart("runnable_00");
		createRunnableThreadStart("runnable_01");
		createRunnableThreadStart("runnable_02");
		createRunnableThreadStart("runnable_03");
		
		System.out.println(Thread.currentThread());
	}
	
	public static void createThreadStart(String name) {
		JJThread thread = new JJThread();
		thread.setName(name);
		thread.start();
	}
	
	public static void createRunnableThreadStart(String name) {
		JJRunnable runnable = new JJRunnable();
		Thread thread = new Thread(runnable);
		thread.setName(name);
		thread.start();
	}
	
	static class JJThread extends Thread{
		@Override
		public void run() {
			super.run();
			System.out.println(Thread.currentThread());
			for (int i = 0; i < printCount; i++) {
				System.out.println(i);
			}
		}
	}
	static class JJRunnable implements Runnable{
		@Override
		public void run() {
			System.out.println(Thread.currentThread());
			for (int i = 0; i < printCount; i++) {
				System.out.println(i);
			}
		}
	}

	
}






